package com.xzq.controller;

import com.xzq.pojo.Result;
import com.xzq.service.ImageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;

@Controller
public class ImageControlleor {

    @Autowired
    private ImageService imageService;

    @RequestMapping("/image")
    public String image(MultipartFile file, int number,String type,boolean isSplit, HttpServletRequest request, Model model) {
        System.out.println(type);
        Result result = imageService.splitImage(file, number, type,isSplit,request);
        model.addAttribute("result", result);
        return "image";
    }

}
